import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "../layout";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home",
    component: Layout,
    children: [
      {
        path: "/home",
        component: () => import("../views/Home/index.vue"),
      },
      {
        path: "/findaroom",
        component: () => import("../views/Findaroom/index.vue"),
      },
      {
        path: "/my",
        component: () => import("../views/My/index.vue"),
      },
    ],
  },
  {
    path: "/city",
    component: () => import("../views/city/index.vue"),
  },
  {
    path: "/detail/:id",
    name: "detali",
    component: () => import("../views/detail/index.vue"),
  },
  {
    path: "/map",
    component: () => import("../views/map/map.vue"),
  },
  {
    path: "/lease",
    component: () => import("../views/lease/index.vue"),
  },
  {
    path: "/search",
    component: () => import("../views/search/index.vue"),
  },
  {
    path: "/housing",
    component: () => import("../views/Housing-management/index.vue"),
  },
  {
    path: "/login",
    component: () => import("../views/login/index.vue"),
  },
  {
    path: "/personal",
    component: () => import("../views/personal/index.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
